/*
md380.h
offer md380 series motor controller driver api and date type define
designed by lunanting

--------------------------------
2020-10-26 17:50:46
create file
--------------------------------
*/
#ifndef __MD380_H
#define __MD380_H

#include "../../bsp/base_type.h"


/****************************data type define********************************/
//电机状态
typedef enum{
    MD380_fw=1, //正转
    MD380_bk,   //反转
    MD380_fw_p, //正转点动
    MD380_bk_p, //反转点动
    MD380_free_stop,    //自由停机
    MD380_fast_stop,    //减速停机
    MD380_err_reset,    //故障复位
}MD380_cmd;


//md380 data
typedef struct{
    int init;   //init status,1=success,0=no init
    int port;   //uart port
    int speed;  //uart speed
    int id;     //slave id
    int freq;    //频率百分比
    MD380_cmd cmd;   //当前电机运行指令 
}MD380_data;



/********************************function extern******************************/
extern int xp_md380_init(int port,int speed,int id);    //md380 init 
extern int xp_md380_freq_set(int freq); //set freq
extern int xp_md380_cmd_set(MD380_cmd cmd); //run cmd set
extern int xp_md380_read(u16 addr);


extern int xp_md380_debug(char *type,char *fun,char *param);    //md380 debug


#endif
//end of file
